Struts中<logic:iterate>的问题。

来源:百度知道 编辑:UC知道 时间:2024/05/22 11:46:06
<logic:notEmpty name="queryalluser">
<logic:iterate id="list" name="queryalluser">
<tr bgcolor="#bae8fc">
<td align="center" >
<bean:write name="list" property="userId" />
</td>
<td align="center">
<bean:write name="list" property="userName" />
</td>
<td align="center">
<bean:write name="list" property="userTrueName" />
</td>
<td align="center">
<html:submit onclick="particular()">详细信息</html:submit>
</td>
</tr>
</logic:iterate>
</logic:notEmpty>

我在页面里这样写的。
我想问的是,我在点击<html:submit>的时候想通过particular()方法给后台传一个userId的值,以便进行增删改查的操作,以

不明白你要说的意思
我有一种方案,可以实现迭代输出的表格数据的CRUD(在表头选项中添加一项“查看详情”通过迭代,每一个详情下都一个连接)
你在迭代中,加入button或者连接标签
比如连接标签 <a href="xxx.action?userid="xxx>常看详情</a>
xxx就是你通过迭代,出来每行的userId 通过标签${list.userId}获取即可。
然后你在xxx这个action中,进行增删改查,就是这样。
不用想象那么复杂。

<html:submit onclick="particular(${list.User.userId})">详细信息</html:submit>
(假设你的用户类为User)
不行的话可以这样:
onclick="location.href='*.do?userId=${list.User.userId}'"

struts1?不懂

你可以在调用particular()的时候传参.
把particular()方法改为带参数的,如:particular(var id).
调用的时候:
<logic:notEmpty name="queryalluser">
<logic:iterate id="list" name="queryalluser">
<tr bgcolor="#bae8fc">
<td align="center" >
<bean:write name="list" property="userId" />
</td>
<td align="center">